import os
import re


def get_path():
    # 获取根路径
    path_list = os.path.split(os.path.realpath(__file__))[0].split("\\")
    path_list.pop()
    project_path = '\\'.join(path_list)
    return project_path


def get_test_project(test_project_name):
    # 获取测试项目路径
    test_project_path = os.path.join(get_path(), "TestCase", test_project_name)
    return test_project_path


def get_file_name(file_dir_path):
    all_files = os.listdir(file_dir_path)  # 输出path下的所有文件名到一个列表中
    # print(all_files)
    for case_dir in all_files:
        if re.match(r"(.*_case)", case_dir, flags=0):
            # print(case_dir)
            return case_dir


if __name__ == '__main__':  # 执行该文件，测试下是否OK
    pass
